# 打印机的状态
CURRENT_STAGE_IDS = {
    "default": ("unknown", "未知"),
    0: ("printing", "打印中"),
    1: ("auto_bed_leveling", "自动床调平"),
    2: ("heatbed_preheating", "热床预热"),
    3: ("sweeping_xy_mech_mode", "XY机械模式扫描"),
    4: ("changing_filament", "更换打印材料"),
    5: ("m400_pause", "M400暂停"),
    6: ("paused_filament_runout", "暂停 - 打印材料耗尽"),
    7: ("heating_hotend", "加热挤出头"),
    8: ("calibrating_extrusion", "校准挤出"),
    9: ("scanning_bed_surface", "扫描打印床表面"),
    10: ("inspecting_first_layer", "检查首层"),
    11: ("identifying_build_plate_type", "识别建造板类型"),
    12: ("calibrating_micro_lidar", "校准微型激光雷达"),
    13: ("homing_toolhead", "归位工具头"),
    14: ("cleaning_nozzle_tip", "清洁喷嘴尖端"),
    15: ("checking_extruder_temperature", "检查挤出头温度"),
    16: ("paused_user", "用户暂停"),
    17: ("paused_front_cover_falling", "暂停 - 前盖掉落"),
    18: ("calibrating_micro_lidar", "校准微型激光雷达"),
    19: ("calibrating_extrusion_flow", "校准挤出流量"),
    20: ("paused_nozzle_temperature_malfunction", "暂停 - 喷嘴温度故障"),
    21: ("paused_heat_bed_temperature_malfunction", "暂停 - 热床温度故障"),
    22: ("filament_unloading", "卸载打印材料"),
    23: ("paused_skipped_step", "暂停 - 跳过步骤"),
    24: ("filament_loading", "载入打印材料"),
    25: ("calibrating_motor_noise", "校准电机噪音"),
    26: ("paused_ams_lost", "暂停 - AMS丢失"),
    27: ("paused_low_fan_speed_heat_break", "暂停 - 低风扇速度/热断"),
    28: ("paused_chamber_temperature_control_error", "暂停 - 室温控制错误"),
    29: ("cooling_chamber", "冷却室"),
    30: ("paused_user_gcode", "用户G代码暂停"),
    31: ("motor_noise_showoff", "电机噪音展示"),
    32: ("paused_nozzle_filament_covered_detected", "暂停 - 检测到喷嘴覆盖的打印材料"),
    33: ("paused_cutter_error", "暂停 - 切割器错误"),
    34: ("paused_first_layer_error", "暂停 - 首层错误"),
    35: ("paused_nozzle_clog", "暂停 - 喷嘴堵塞"),
    -1: ("idle", "空闲"),
    255: ("idle", "空闲")
}
# 异常问题
HMS_ERRORS_ENGLISH = {
    "0300_1000_0002_0001": ("The 1st order mechanical resonance mode of X axis is low.", "X轴的第一阶机械谐振模式较低。"),
    "0300_1000_0002_0002": ("The 1st order mechanical resonance mode of X axis differ much...", "X轴的第一阶机械谐振模式差异较大..."),
    "0300_0F00_0001_0001": ("The accelerometer data is unavailable", "加速度计数据不可用"),
    "0300_0D00_0001_000B": ("The Z axis motor seems got stuck when moving up", "Z轴电机在向上移动时似乎卡住了"),
    "0300_0D00_0001_0002": ("Hotbed homing failed. The environmental vibration is too great", "热床归位失败。环境振动过大"),
    "0300_0D00_0001_0003": ("The build plate is not placed properly ...", "打印平台未正确放置..."),
    "0300_0D00_0002_0001": ("Heatbed homing abnormal. There may be a bulge on the ...", "热床归位异常。可能有凸起..."),
    "0300_0A00_0001_0005": ("the static voltage of force sensor 1/2/3 is not 0 ...", "力传感器1/2/3的静态电压不为0..."),
    "0300_0A00_0001_0004": ("External disturbance was detected when testing the force sensor", "测试力传感器时检测到外部干扰"),
    "0300_0A00_0001_0003": ("The sensitivity of heatbed force sensor 1/2/3 is too low....", "热床力传感器1/2/3的灵敏度过低..."),
    "0300_0A00_0001_0002": ("The sensitivity of heatbed force sensor 1/2/3 is low...", "热床力传感器1/2/3的灵敏度较低..."),
    "0300_0A00_0001_0001": ("The sensitivity of heatbed force sensor 1/2/3 is too high...", "热床力传感器1/2/3的灵敏度过高..."),
    "0300_0400_0002_0001": ("The speed of part cooling fan if too slow or stopped ...", "部件冷却风扇的速度过慢或停止..."),
    "0300_0300_0002_0002": ("The speed of hotend fan is slow ...", "喷嘴风扇的速度较慢..."),
    "0300_0300_0001_0001": ("The speed of the hotend fan is too slow or stopped...", "喷嘴风扇的速度过慢或停止..."),
    "0300_0600_0001_0001": ("Motor-A has an open-circuit. There may be a loose connection, or the motor may have failed.", "电机-A存在开路。可能是连接松动，或电机可能已损坏。"),
    "0300_0600_0001_0002": ("Motor-A has a short-circuit. It may have failed.", "电机-A存在短路。可能已损坏。"),
    "0300_0600_0001_0003": ("The resistance of Motor-A is abnormal, the motor may have failed.", "电机-A的电阻异常，可能电机已损坏。"),
    "0300_0100_0001_0001": ("The heatbed temperature is abnormal, the heater may have a short circuit.", "热床温度异常，加热器可能存在短路。"),
    "0300_0100_0001_0002": ("The heatbed temperature is abnormal, the heater may have an open circuit, or the thermal switch may be open.", "热床温度异常，加热器可能存在断路，或热敏开关可能已打开。"),
    "0300_0100_0001_0003": ("The heatbed temperature is abnormal, the heater is over temperature.", "热床温度异常，加热器超温。"),
    "0300_0100_0001_0006": ("The heatbed temperature is abnormal, the sensor may have a short circuit.", "热床温度异常，传感器可能存在短路。"),
    "0300_0100_0001_0007": ("The heatbed temperature is abnormal, the sensor may have an open circuit.", "热床温度异常，传感器可能存在断路。"),
    "0300_1300_0001_0001": ("The current sensor of Motor-A is abnormal. This may be caused by a failure of the hardware sampling circuit.", "电机-A的电流传感器异常。可能是硬件采样电路故障引起。"),
    "0300_4000_0002_0001": ("Data transmission over the serial port is abnormal, the software system may be faulty.", "串口数据传输异常，软件系统可能存在故障。"),
    "0300_4100_0001_0001": ("The system voltage is unstable, triggering the power failure protection function.", "系统电压不稳定，触发断电保护功能。"),
    "0300_0200_0001_0001": ("The nozzle temperature is abnormal, the heater may be short circuit.", "喷嘴温度异常，加热器可能存在短路。"),
    "0300_0200_0001_0002": ("The nozzle temperature is abnormal, the heater may be open circuit.", "喷嘴温度异常，加热器可能存在断路。"),
    "0300_0200_0001_0003": ("The nozzle temperature is abnormal, the heater is over temperature.", "喷嘴温度异常，加热器超温。"),
    "0300_0200_0001_0006": ("The nozzle temperature is abnormal, the sensor may be short circuit.", "喷嘴温度异常，传感器可能存在短路。"),
    "0300_0200_0001_0007": ("The nozzle temperature is abnormal, the sensor may be open circuit.", "喷嘴温度异常，传感器可能存在断路。"),
    "0300_1200_0002_0001": ("The front cover of the toolhead fell off.", "工具头的前盖脱落。"),
    "0C00_0100_0001_0001": ("The Micro Lidar camera is offline.", "微型激光雷达摄像头离线。"),
    "0C00_0100_0002_0002": ("The Micro Lidar camera is malfunctioning.", "微型激光雷达摄像头故障。"),
    "0C00_0100_0001_0003": ("Synchronization between Micro Lidar camera and MCU is abnormal.", "微型激光雷达摄像头与MCU的同步异常。"),
    "0C00_0100_0001_0004": ("The Micro Lidar camera lens seems to be dirty.", "微型激光雷达摄像头镜头似乎脏了。"),
    "0C00_0100_0001_0005": ("Micro Lidar OTP parameter is abnormal.", "微型激光雷达OTP参数异常。"),
    "0C00_0100_0002_0006": ("Micro Lidar extrinsic parameter abnormal.", "微型激光雷达外参参数异常。"),
    "0C00_0100_0002_0007": ("Micro Lidar laser parameters are drifted.", "微型激光雷达激光参数漂移。"),
    "0C00_0100_0002_0008": ("Failed to get image from chamber camera.", "无法从室内摄像头获取图像。"),
    "0C00_0100_0001_0009": ("Chamber camera dirty.", "室内摄像头脏了。"),
    "0C00_0100_0001_000A": ("The Micro Lidar LED may be broken.", "微型激光雷达LED可能损坏。"),
    "0C00_0100_0001_000B": ("Failed to calibrate Micro Lidar.", "微型激光雷达校准失败。"),
    "0C00_0200_0001_0001": ("The horizontal laser is not lit.", "水平激光未点亮。"),
    "0C00_0200_0002_0002": ("The horizontal laser is too thick.", "水平激光过粗。"),
    "0C00_0200_0002_0003": ("The horizontal laser is not bright enough.", "水平激光不够明亮。"),
    "0C00_0200_0002_0004": ("Nozzle height seems too low.", "喷嘴高度似乎太低。"),
    "0C00_0200_0001_0005": ("A new Micro Lidar is detected.", "检测到新的微型激光雷达。"),
    "0C00_0200_0002_0006": ("Nozzle height seems too high.", "喷嘴高度似乎太高。"),
    "0C00_0300_0002_0001": ("Filament exposure metering failed.", "曝光计量失败。"),
    "0C00_0300_0002_0002": ("First layer inspection terminated due to abnormal lidar data.", "由于激光雷达数据异常，首层检测终止。"),
    "0C00_0300_0002_0004": ("First layer inspection not supported for current print.", "当前打印不支持首层检测。"),
    "0C00_0300_0002_0005": ("First layer inspection timeout.", "首层检测超时。"),
    "0C00_0300_0003_0006": ("Purged filaments may have piled up.", "排出的丝可能堆积在一起。"),
    "0C00_0300_0003_0007": ("Possible first layer defects.", "可能存在首层缺陷。"),
    "0C00_0300_0003_0008": ("Possible spaghetti defects were detected.", "可能检测到意大利面条缺陷。"),
    "0C00_0300_0001_0009": ("The first layer inspection module rebooted abnormally.", "首层检测模块异常重启。"),
    "0C00_0300_0003_000B": ("Inspecting first layer.", "正在检测首层。"),
    "0C00_0300_0002_000C": ("The build plate localization marker is not detected.", "未检测到打印平台定位标记。"),
    "0500_0100_0002_0001": ("The media pipeline is malfunctioning.", "媒体管道故障。"),
    "0500_0100_0002_0002": ("USB camera is not connected.", "USB摄像头未连接。"),
    "0500_0100_0002_0003": ("USB camera is malfunctioning.", "USB摄像头故障。"),
    "0500_0100_0003_0004": ("Not enough space in SD Card.", "SD卡空间不足。"),
    "0500_0100_0003_0005": ("Error in SD Card.", "SD卡错误。"),
    "0500_0100_0003_0006": ("Unformatted SD Card.", "未格式化的SD卡。"),
    "0500_0200_0002_0001": ("Failed to connect internet, please check the network connection.", "无法连接互联网，请检查网络连接。"),
    "0500_0200_0002_0002": ("Failed to login device.", "设备登录失败。"),
    "0500_0200_0002_0004": ("Unauthorized user.", "未经授权的用户。"),
    "0500_0200_0002_0006": ("Liveview service is malfunctioning.", "实时查看服务故障。"),
    "0500_0300_0001_0001": ("The MC module is malfunctioning. Please restart the device.", "MC模块故障。请重新启动设备。"),
    "0500_0300_0001_0002": ("The toolhead is malfunctioning. Please restart the device.", "工具头故障。请重新启动设备。"),
    "0500_0300_0001_0003": ("The AMS module is malfunctioning. Please restart the device.", "AMS模块故障。请重新启动设备。"),
    "0500_0300_0001_000A": ("System state is abnormal. Please restore factory settings.", "系统状态异常。请恢复出厂设置。"),
    "0500_0300_0001_000B": ("The screen is malfunctioning.", "屏幕故障。"),
    "0500_0300_0002_000C": ("Wireless hardware error. Please turn off/on WiFi or restart the device.", "无线硬件错误。请关闭/打开WiFi或重新启动设备。"),
    "0500_0400_0001_0001": ("Failed to download print job. Please check your network connection.", "无法下载打印任务。请检查网络连接。"),
    "0500_0400_0001_0002": ("Failed to report print state. Please check your network connection.", "无法报告打印状态。请检查网络连接。"),
    "0500_0400_0001_0003": ("The content of print file is unreadable. Please resend the print job.", "打印文件内容无法读取。请重新发送打印任务。"),
    "0500_0400_0001_0004": ("The print file is unauthorized.", "打印文件未经授权。"),
    "0500_0400_0001_0006": ("Failed to resume previous print.", "无法恢复之前的打印。"),
    "0500_0400_0002_0007": ("The bed temperature exceeds the filament's vitrification temperature, which may cause a nozzle clog.", "床温超过了丝的玻璃化温度，可能导致喷嘴堵塞。"),
    "0700_4000_0002_0001": ("The filament buffer signal lost, the cable or position sensor may be malfunctioning.", "丝材缓冲信号丢失，电缆或位置传感器可能故障。"),
    "0700_4000_0002_0002": ("The filament buffer position signal error, the position sensor may be malfunctioning.", "丝材缓冲位置信号错误，位置传感器可能故障。"),
    "0700_4000_0002_0003": ("The AMS Hub communication is abnormal, the cable may be not well connected.", "AMS Hub通信异常，电缆可能连接不良。"),
    "0700_4000_0002_0004": ("The filament buffer signal is abnormal, the spring may be stuck.", "丝材缓冲信号异常，弹簧可能卡住。"),
    "0700_4500_0002_0001": ("The filament cutter sensor is malfunctioning. The sensor may be disconnected or damaged.", "丝材切割传感器故障。传感器可能断开或损坏。"),
    "0700_4500_0002_0002": ("The filament cutter's cutting distance is too large. The XY motor may lose steps.", "丝材切割距离过大。XY电机可能失步。"),
    "0700_4500_0002_0003": ("The filament cutter handle has not released. The handle or blade may be stuck.", "丝材切割手柄未释放。手柄或刀片可能卡住。"),
    "0700_5100_0003_0001": ("AMS is disabled, please load filament from spool holder.", "AMS已禁用，请从卷筒支架加载丝材。"),
    "12FF_2000_0002_0001": ["External filament has run out, please load a new filament.", "外部丝料已用完，请加载新的丝料。"],
    "12FF_2000_0002_0002": ["External filament is missing, please load a new filament.", "外部丝料缺失，请加载新的丝料。"],
    "12FF_2000_0002_0004": ["Please pull out the filament on the spool holder from the extruder.", "请从挤出机上的卷轴支架上拉出丝料。"]
    }
